import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart';
class MyNavigatorObservers extends NavigatorObserver{
  // 当调用Navigator.pop时回调
  @override
  void didPush(Route route, Route? previousRoute) {
    // TODO: implement didPop
    super.didPush(route, previousRoute);
    print("didPush router setting is" + route.settings.toString());
    print("didPush route setting.name is" + route.settings.name.toString());
    if(previousRoute != null){
      print("didPush previousRoute settings is " + previousRoute.settings.toString());
    print("didPush previousRouter settings.name is" + previousRoute.settings.name.toString());

    }
    
  }
  // 当调用Navigator.push时回调

  @override
  void didPop(Route route, Route? previousRoute) {
    // TODO: implement didPush
    super.didPop(route, previousRoute);
    print("didPop router setting is" + route.settings.toString());
    print("didPop route setting.name is" + route.settings.name.toString());
    if(previousRoute != null){
      print("didPop previousRoute settings is " + previousRoute.settings.toString());
      print("didPop previousRouter settings.name is" + previousRoute.settings.name.toString());

    }
    
  }


}